Fractale Tree  0.5
Plot Tree Fractale
qwidget_trees.cpp
Go to the documentation of this file.
1 #include "qwidget_trees.h"
2 
4 {
5  qDebug() << "Etape 2.1";
6  //Init
9 
10  // HBoxLayou_tree
11  QHBoxLayout *HBoxLayou_tree = new QHBoxLayout;
12  //Boucle Tab_Widget_tree
13  for(int i=0;i<nb_Widget_tree;i++)
14  {
15  Tab_Widget_tree[i] = new QWidget_tree();
16  HBoxLayou_tree->addWidget(Tab_Widget_tree[i]);
17  QObject::connect(Tab_Widget_tree[i],SIGNAL(Value_changed()),this,SIGNAL(Value_changed()));
18  }
19  //QGroupBox_tree
20  QGroupBox *QGroupBox_tree = new QGroupBox(tr("Tree"));
21  QGroupBox_tree->setLayout(HBoxLayou_tree);
22 
23  // HBoxLayout
24  HBoxLayout = new QHBoxLayout();
25  HBoxLayout->addWidget(QGroupBox_tree);
26 
27  //setLayout
28  this->setLayout(HBoxLayout);
29 
30  //Upadate
31  Update_Value();
32 
33  //
34  QObject::connect(this,SIGNAL(Value_changed()),this,SLOT(Update_Value()));
35 }
36 
38 {
39  int total=0;
40  for(int i=0;i<nb_Widget_tree;i++)
41  {
42  total=total+Tab_Widget_tree[i]->Get_Value();
43  }
44  double prcent=100/((double)total);
45  for(int i=0;i<nb_Widget_tree;i++)
46  {
47  int value=Tab_Widget_tree[i]->Get_Value();
48  Tab_Widget_tree[i]->Set_Prcent(value*prcent);
49  stock_prcent.Set_Prcent_By_Index(i,value*prcent);
50  }
51 }
52 
53 
55 {
56  return stock_prcent;
57 }
58 
59 
61 {
62  if(index>=0 && index<nb_Widget_tree)
63  {
64  return Tab_Widget_tree[index]->Get_Value();
65  }
66  return 0;
67 }
68 
70 {
71  return nb_Widget_tree;
72 }
73 
74 
75 void QWidget_trees::Set_Value_By_Index(int index, int value)
76 {
77  if(index>=0 && index<nb_Widget_tree)
78  {
79  Tab_Widget_tree[index]->Set_Value(value);
80  }
81 }
82 
void Set_Prcent_By_Index(int index, double prcent)
QWidget_tree * Tab_Widget_tree[10]
Definition: qwidget_trees.h:38
int Get_Nb_Widget_tree()
void Set_Prcent(double prcent)
int Get_Value_By_Index(int index)
void Value_changed()
void Set_Value(int value)
void Set_Size(int size)
Definition: stock_prcent.cpp:8
Stock_Prcent Get_Stock_Prcent()
QHBoxLayout * HBoxLayout
Definition: qwidget_trees.h:40
Widget trees, Gestion un nombre de branche et de leurs largeur.
Stock_Prcent stock_prcent
Definition: qwidget_trees.h:42
void Set_Value_By_Index(int index, int value)